Best Practices for Data Visualisation

RSS International Conference 2023

Andreas Krause, Nicola Rennie, and Brian Tarran

Welcome

Brian to add content

About the guide

Brian to add content

Why visualise data?

Motivation

Andreas to add content

Principles and elements of visualisation

Elements of charts

Andreas to add content

Styling charts

What’s wrong with this chart?

Colours

Nicola to add content

Annotations

Nicola to add content

Fonts

Nicola to add content

Alt Text

Alt text (AKA alternative text) is text that describes the visual aspects and purpose of an image – including charts.

Though alt text has various uses, its primary purpose is to aid visually impaired users in interpreting images when the alt text is read aloud by screen readers.

Alt Text

Screenshot of Medium article on how to write alt text, which includes a chart type, type of data, reason for including chart, and link to data source

Source: medium.com/nightingale/writing-alt-text-for-data-visualization (Amy Cesal)

Styling for RSS publications

Styling for Significance Magazine

Nicola to add content

{RSSthemes} R package

  • Colour palettes

  • Base R helper functions

  • {ggplot2} helper functions

Installation

Installing from GitHub:

remotes::install_github("nrennie/RSSthemes")

Load package:

library(RSSthemes)

Example: plotting with base R

barplot(
  height = table(mtcars$gear),
  col = factor(
    unique(mtcars$gear)
    )
)

set_rss_palette("signif_qual")
barplot(
  height = table(mtcars$gear),
  col = factor(
    unique(mtcars$gear)
    )
)

Example: plotting with ggplot2}

  • {ggplot2} is an R package that provides functionality for drawing graphics.
install.packages("ggplot2")

ggplot2 hex sticker logo

{ggplot2}: basic plot

library(ggplot2)
g <- ggplot(data = mtcars) +
  geom_bar(
    mapping = aes(
      x = cyl,
      fill = factor(vs)
      )
    )
g

{ggplot2}: scales

g +
  scale_fill_rss_d("signif_qual")

{ggplot2}: theme

g +
  scale_fill_rss_d("signif_qual") +
  theme_significance()

Contributing to the guide

Quarto

Quarto is an open-source scientific and technical publishing system that allows you to combine text, images, code, plots, and tables in a fully-reproducible document. Quarto has support for multiple languages including R, Python, Julia, and Observable. It works for a range of output formats such as PDFs, HTML documents, websites, presentations,…

quarto hex sticker logo

GitHub

The source code for the guide is stored on GitHub.

If you want to contribute to the guide, the easiest way is via a GitHub pull request.

GitHub link: github.com/royal-statistical-society/datavisguide

Contributor guide: royal-statistical-society.github.io/datavisguide/howto.html#how-to-contribute-to-this-guide

GitHub: Make a fork

Screenshot of github repository with fork button highlighted

GitHub: Clone the repository

Screenshot of github repository with clone button highlighted

GitHub: Make some changes and commit them

Nicola to add content

GitHub: Create a pull request

Nicola to add content

Need help with GitHub?

Ask us!

Conference session: GitHub: Version control for research, teaching and industry, Thu 7th @ 11:40

Your turn!

All to add content